package com.powernode.boss.controller;

import com.powernode.boss.models.Result;
import com.powernode.boss.models.dto.OperatorLoginDto;
import com.powernode.boss.models.request.OperatorLoginRequest;
import com.powernode.boss.service.OperatorService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
public class OperatorController {
    @Resource
    private OperatorService operatorService;

    @PostMapping("/operation/login")
    public Result login(@RequestBody @Validated OperatorLoginRequest loginRequest){
        //1.参数验证

        //2.业务逻辑，查询用户，比较密码
        OperatorLoginDto dto = operatorService.login(loginRequest);

        return Result.ok  (dto);
    }

}
